import React from 'react';
import ReactEcharts from 'echarts-for-react';
// 引入 ECharts 主模块
import echarts from 'echarts/lib/echarts'
// 引入饼图和折线图
import 'echarts/lib/chart/line';
// 引入提示框和标题组件
import 'echarts/lib/component/tooltip';
import 'echarts/lib/component/title';
import 'echarts/lib/component/legend';
import 'echarts/lib/component/markPoint';
import customTheme from './echart/theme.js';
import themeLight from './echart/themeLight.js';

export default class ExEchart extends React.Component {
  componentWillMount(){
      echarts.registerTheme('customTheme',themeLight);
  }
  render() {

    const { style = { height: 300 }, option } = this.props;
    return (
      <ReactEcharts
        theme="customTheme"
        notMerge
        lazyUpdate
        option={option}
        style={style}
      />
    );
  }
}
